<%@ page import="auctionhaus.Listing" %>

<!-- S-6: A logged in user can create a new listing via a simple form; newly created listings will appear in the "My Listings" view -->
<div class="fieldcontain ${hasErrors(bean: listingInstance, field: 'name', 'error')} required">
	<label for="name">
		<g:message code="listing.name.label" default="Name" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="name" maxlength="63" required="" value="${listingInstance?.name}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: listingInstance, field: 'description', 'error')} ">
	<label for="description">
		<g:message code="listing.description.label" default="Description" />
		
	</label>
	<g:textArea name="description" cols="40" rows="5" maxlength="255" value="${listingInstance?.description}"/>
</div>



<div class="fieldcontain ${hasErrors(bean: listingInstance, field: 'endDateTime', 'error')} required">
	<label for="endDateTime">
		<g:message code="listing.endDateTime.label" default="End Date Time" />
		<span class="required-indicator">*</span>
	</label>
	<g:datePicker name="endDateTime" precision="minute" value="${listingInstance?.endDateTime}" default="${new Date().plus(7)}" />
</div>



<div class="fieldcontain ${hasErrors(bean: listingInstance, field: 'startingPrice', 'error')} required">
	<label for="startingPrice">
		<g:message code="listing.starting.price.label" default="Starting Price" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" step=".01" name="startingPrice" required="" value="${fieldValue(bean: listingInstance, field: 'startingPrice')}"/>
</div>



<g:if  test="${listingInstance?.bids}">

<div class="fieldcontain ${hasErrors(bean: listingInstance, field: 'bids', 'error')} ">
	<label for="bids">
		<g:message code="listing.bids.label" default="Bids" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${listingInstance?.bids?}" var="b">
    <li><g:link controller="bid" action="show" id="${b.id}">${b?.encodeAsHTML()}</g:link></li>
</g:each>
</ul>

</div>
</g:if>



	<g:hiddenField id="seller" name="seller.id" value="${sec.loggedInUserInfo(field:'id')}" />

